package com.megvii.koala.constance;

import android.content.Context;

import com.megvii.koala.R;

import java.util.HashMap;

/**
 * Created by linyue on 15/12/21.
 */
public class ErrorCode extends ServerErrorCode
{
    ////////////////  code for app  ////////////////
    public static final int NO_ERROR = 0;

    public static final int USERNAME_NULL = 966001;

    public static final int PASSWORD_NULL = 966002;

    public static final int REPEAT_PASSWORD_ILLEGAL = 966003;

    public static final int NAME_NULL = 966004;

    public static final int NAME_LIMIT = 966005;

    public static final int REMARK_LIMIT = 966006;

    public static final int VISIT_TIME_TOO_SHORT = 966007;

    public static final int DEPARTMENT_LIMIT = 966008;

    public static final int PHONE_LIMIT = 966009;

    public static final int DESCRIPTION_LIMIT = 966010;

    public static final int INTERVIEWEE_NAME_NULL = 966011;

    public static final int INTERVIEWEE_NAME_LIMIT = 966012;

    public static final int RANK_LIMIT = 966013;

    public static final int TITLE_LIMIT = 966014;

    public static final int EMAIL_LIMIT = 966015;

    public static final int PURPOSE_ILLEGAL = 966016;

    //
    public static final int FACE_QUALITY_LOW = 968001;

    public static final int FACE_NOT_DETECTED = 968002;

    //
    public static final int WE_CHAT_NOT_INSTALLED = 980001;

    public static final int ANDROID_API_NOT_SUPPORT_WE_CHAT_SDK = 980002;

    //
    public static final int CANNOT_PLAY_VIDEO = 1000001;

    private static HashMap<Integer, String> stringMap = new HashMap<>();

    public static void init(Context context)
    {
        stringMap = ServerErrorCode.getMapping(ErrorCode.class, R.string.class, context);
    }

    public static String getDescription(int code)
    {
        String str = stringMap.get(code);
        if (str == null)
        {
            return "ERROR " + code;
        }
        else
        {
            return str;
        }
    }
}
